import { Injectable } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";
import { Repository } from "typeorm";

import { TonTpl, TonTplGateway, TonTplGroup, TonTplGroupGateway } from "qqlx-core";
import { TonTplSchema, TonTplGroupSchema } from "qqlx-cdk";

import { PgDao } from "../../lib/dao.pg.id";

@Injectable()
export class TonTplGroupDao extends PgDao<TonTplGroup> {
  constructor(
    @InjectRepository(TonTplGroupSchema)
    readonly repo: Repository<TonTplGroup>,
  ) {
    super({
      repository: repo,
      relations_name: TonTplGroupGateway.relations,
    });
  }
}

@Injectable()
export class TonTplDao extends PgDao<TonTpl> {
  constructor(
    @InjectRepository(TonTplSchema)
    readonly repo: Repository<TonTpl>,
  ) {
    super({
      repository: repo,
      relations_name: TonTplGateway.relations,
    });
  }
}
